package edu.friday.controller;

import edu.friday.common.base.BaseController;
import edu.friday.common.result.RestResult;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/demo")
public class DemoController extends BaseController {
    @PostMapping
    public RestResult add() {
        return RestResult.success();
    }

    @PutMapping
    public RestResult update() {
        return RestResult.success();
    }

    @GetMapping(value = {"/","{userId}"})
    public RestResult get(@PathVariable(value = "userId", required = false) String userId) {
        if (userId == null) {
            return RestResult.error();
        }
        return RestResult.success(userId);
    }
}
